<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@page import="java.text.DateFormat"%>
<%@page import="com.ereport.entity.DailyActivity"%>
<%@page import="com.ereport.dao.AccountsDAO"%>
<%@page import="com.ereport.entity.Accounts"%>
<%@page import="java.util.List"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<link href="<%=application.getContextPath() %>/css/css.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=application.getContextPath() %>/js/jquery-1.6.min.js"></script>	
<script language="javascript" src="<%=application.getContextPath() %>/js/calendar_eu.js"></script>
<script type="text/javascript" src="<%=application.getContextPath() %>/js/jquery-ui-1.8.17.custom.min.js"></script>	
<link rel="stylesheet" href="<%=application.getContextPath() %>/css/jquery-ui-1.8.17.custom.css"/>


<script type="text/javascript">
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
</script>

</head>
<style>

	#editor{
	width:95%;
	}
	#remarksEditor{
	width:95%;
	}
	#nextsteppopup {
	position:absolute;
  z-index:200; /* aaaalways on top*/
  padding: 3px;
 
  width: 250px;
  color: white;
	}
	.ui-dialog .ui-state-error { padding: .3em; }
	.ui-corner-all{
	font-family: Arial, Helvetica, sans-serif;
	font-size: 11px;
	font-weight: normal;
	color: #666666;
	text-decoration: none;
	}
	.ui-corner-all:hover{
	font-family: Arial, Helvetica, sans-serif;
	font-size: 11px;
	font-weight: normal;
	color: #666666;
	text-decoration: none;
	}
	.logout{
	font-family: Arial, Helvetica, sans-serif;
	font-size: 11px;
	height: 15px;
	width: 50px;
	font-weight: normal;
	color: red;
	text-decoration: none;
	}
	#bulletinDialog title{
	font-family:Arial, Helvetica, sans-serif;
	font-size:14px;
	font-weight:bold;
	}
	</style>
  <script>

	$(function() {
		$( "#datepicker" ).datepicker({ dateFormat: "dd-mm-yy" });
	});
	</script>
<body>
<form action="enquiry.php" method="post" name="myform"><table width="927" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr>
    <td height="116" align="left" valign="top" background="<%=application.getContextPath() %>/images/top-bg.jpg" style="background-repeat:repeat-x; background-position:left top">
    <%@ include file="common/exe-header.jsp" %>
    </td>
  </tr>
   <tr>
    <td align="left" valign="top">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    	<tr>
    		<td align="left" valign="top">&nbsp;&nbsp;&nbsp;
    			<a href="<%=application.getContextPath() %>/user/open.do"><img src="<%=application.getContextPath() %>/images/home1.jpg" width="20" height="20" border="0" /></a>
    		</td>
    	<td align="center" valign="top">
    	<%
        if(request.getParameter("success")!=null){
        	out.println(request.getParameter("success"));
        }
        %>
    	</td>
    	<td width="8%" align="center"><a href="<%=application.getContextPath() %>/user/logout.do" style="font-family: sans-serif;">&nbsp;&nbsp;Logout</a></td>
    	</tr>
    	
    </table>
    </td>
  </tr>
  <%
  List<Accounts> acList=(List<Accounts>)request.getAttribute("acList");
  %>
  <tr>
    <td height="600" align="left" valign="top">
    <table width="98%" height="298" align="center" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td width="100%" align="center" valign="top"><table width="100%" cellpadding="0" cellspacing="0" class="box-border1">
          <tr>
            <td align="left" valign="top"><table width="100%" border="0" cellspacing="1" cellpadding="1">
              <tr>
              	<td width="2%" height="21" align="center" style="background:url(<%=application.getContextPath() %>/images/hed-bg-block.jpg); background-repeat:repeat-x;" class="links">S.No</td>
                <td height="21" align="center" style="background:url(<%=application.getContextPath() %>/images/hed-bg-block.jpg); background-repeat:repeat-x;" class="links">Account Name</td>
                <td align="center" style="background:url(<%=application.getContextPath() %>/images/hed-bg-block.jpg); background-repeat:repeat-x;" class="links">Account Number</td>
                <td align="center" style="background:url(<%=application.getContextPath() %>/images/hed-bg-block.jpg); background-repeat:repeat-x;" class="links">Account Type</td>
                <td align="center" style="background:url(<%=application.getContextPath() %>/images/hed-bg-block.jpg); background-repeat:repeat-x;" class="links">Last Contacted</td>
                <td align="center" style="background:url(<%=application.getContextPath() %>/images/hed-bg-block.jpg); background-repeat:repeat-x;"	 class="links">Segment</td>
              </tr>
              <%
              for(int i=0;i<acList.size();i++){
            	  Executives exc=(Executives)session.getAttribute("loginUser");
            	  String orgName=acList.get(i).getAccName();
            	  AccountsDAO adao=new AccountsDAO();
            	 List<DailyActivity> dlist= adao.getlastcontacted(exc.getId(),orgName);
            	
            	Date lcont=null;
            	DateFormat dfmt = new SimpleDateFormat("dd-MM-yyyy");
            	 for(int j=0;j<dlist.size();j++){
            		lcont=dlist.get(j).getEdate();
            		System.out.println("last cont date "+lcont);
            	 }
            	 
            	 String lc=dfmt.format(lcont);
              %>
              <tr>
                <td align="center" bgcolor="#cccccc"><%=i+1 %></td>
                <td align="center" bgcolor="#cccccc"><%=acList.get(i).getAccName() %></td>
                <td align="center" bgcolor="#cccccc"><%=acList.get(i).getAccNumber() %></td>
                <td align="center" bgcolor="#cccccc"></td>
                <td align="center" bgcolor="#cccccc"><%=lc %></td>
                
              </tr>
              <%
              }
              %>
            </table></td>
            </tr>
        </table></td>
        </tr>
    </table></td>
  </tr>
  <tr>
    <td height="40" align="left" valign="top" bgcolor="#0B0B0B">&nbsp;</td>
  </tr>
</table></form>
</body>
</html>
